/**
*AUTHOR:第七页(diqye) 2014年10月13日,  22:27:54 QQ:262666212
*/
(function(root,factory){
	if (typeof define === 'function' && define.amd) {
		define(function(){
			return factory.call(root);
		});
	}else{
		var COOKIE=factory.call(root);
	}
}(this,function(){
	return {
		"add":function(objName,objValue,objHours){
			var str = objName + "=" + escape(objValue);
			 if(objHours > 0){
				var date = new Date();
				var ms = objHours*3600*1000;
				date.setTime(date.getTime() + ms);
				str += "; expires=" + date.toGMTString();
				document.cookie = str;
			 }
		},
		"get":function(objName){
			var arrStr = document.cookie.split("; ");
			for(var i = 0;i < arrStr.length;i ++){
				var temp = arrStr[i].split("=");
				if(temp[0] == objName) return unescape(temp[1]);
			}
			return null;
		},
		"remove":function(name){
			var exp = new Date();
			exp.setTime(exp.getTime() - 1);
			var cval=this.get(name);
			if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
		}
	};
}));